@extends('template.adminpage')
@section('content')

<ol class="breadcrumb">
  <li class="active">ID Card quality</li>
</ol>

<div class="container-black">
	<br>
  <label><u>Pencarian</u></label>
  
	<form action="{{URL::to('/idcard/idcardqualitys')}}" method="POST">
        <div class="input-group" >
           <label class="pull-left" style="margin-top:5px">Quality (Kualitas)  </label>
           <input type="text" class="form-control pull-left" name="filter" style="width:250px;height:30px; margin-left:10px" value="{{Session::get('filter')}}">
           <span class="input-group-btn pull-left">
             <button class="btn btn-dark btn-sm" type="submit" style="width:100px;height:30px"><span class="fa fa-search"></span> Tampilkan</button>
           </span>
        </div><!-- /input-group -->
    </form>
    <br>
     <form action="{{URL::to('/idcard/idcardquality/deleteidcardquality')}}"  method="post" >
    <p><a data-toggle="modal" data-target="#addidcardquality"><button class="btn btn-sm btn-dark" style="height:30px" ><span class="fa fa-plus"></span> Tambah</button></a> <button style="height:30px" class="btn btn-sm btn-dark" type="submit" ><span class="fa  fa-times"></span> Hapus</button></p>
  	  <?php
        $limit = 10;
        if(Input::get('page')==0 OR Input::get('page')==1){ 
         $no = 1;
        }
        else{
        $no = ((Input::get('page')-1)*$limit)+1;
        } ?>
     <table class="table table-bordered table-hover">
      <thead>
        <tr>
          <th><input type="checkbox" name="checkall" id="terserah" onclick="check_all('terserah', {{$no}})" ></input></th>
          <th>No</th>
          <th>Nama</th>
          <th>Harga</th>
          <th>Aksi</th>
        </tr>
      </thead>
      <tbody>
        
        @foreach($idcardquality as $quality)
        <tr>
          <td><input type="checkbox" name="{{$quality->idcard_quality_id}}" value='1' id="terserah_{{$no}}" ></input></td>
          <td>{{$no}}</td>
          <td>{{$quality->idcard_quality_name}}</td>
          <td>{{$quality->idcard_quality_price.' / '.$quality->idcard_quality_qty.' '.$quality->idcard_quality_unit}}</td>
          <td><a data-toggle="modal" data-target="#{{$quality->idcard_quality_id}}"><button class="btn btn-xs btn-dark"><span class="fa fa-edit"></span> Ubah</button></a></td>
        </tr>
        <?php $no++; ?>
        @endforeach
      </tbody>
    </table>
  </form>
    <div class="text-right"><?php echo $idcardquality->links(); ?></div>

    <div class="modal fade" id="addidcardquality" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">Tambah data kualitas ID Card  </label></h4>
                    </div>
                   <div align="left">
                   <br>
                          {{Form::open(array(
                                'url' => '/idcard/idcardquality/addidcardquality',
                                'method' => 'POST'
                              ))}}
                          <div class="row">
                          <div class="col-md-8 col-md-offset-1">


                                  <div class="row">
                                  <div class="col-lg-4">
                                  <label>Nama kualitas <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text"  class="form-control"  name="idcard_quality_name" placeholder="Nama kualitas"style="width:200px;height:30px" value="" required /></input>
                                  </div>
                                  </div>
                                  <br>
                                  <div class="row">
                                  <div class="col-lg-4">
                                  <label>Harga <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text"  class="form-control"  name="idcard_quality_price" placeholder="Harga"style="width:200px;height:30px" value="" required /></input>
                                  </div>
                                  </div>
                                  <br>
                                    <div class="row">
                                    <div class="col-lg-4">
                                      <label>Qty </label>
                                    </div>
                                    <div class="col-lg-3">
                                     <input type="text"  class="form-control"  name="idcard_quality_qty" placeholder="1" style="width:90px;height:30px" value="" /></input>
                                    </div>
                                    <div class="col-lg-1">
                                     /
                                    </div>
                                    
                                    <div class="col-lg-3">
                                      <select  class="form-control"  name="idcard_quality_unit" style="width:80px;height:30px">
                                        <option value="Pcs">Pcs</option>
                                        <option value="Card">Card</option>
                                        <option value="Box">Box</option>
                                      </select>
                                    </div>
                                    </div>
                                    <br>
                                      <font color="red" class="text-left">* Data tidak boleh kosong</font>



                          </div>

                          </div>

                </div>


                    <div class="modal-footer">

                    <button type="submit" class="btn btn-sm btn-dark"><span class="fa fa-floppy-o"></span> Simpan</button>{{Form::close()}} <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Batal</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>

              @foreach($idcardquality as $quality)
              <div class="modal fade" id="{{$quality->idcard_quality_id}}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">Ubah data kualitas ID Card  </label></h4>
                    </div>
                    <div align="left">
                              {{Form::open(array(
                                    'url' => '/idcard/idcardquality/editidcardquality/'.$quality->idcard_quality_id,
                                    'method' => 'POST'
                                  ))}}
                              <div class="row" style="margin-top:10px">
                              <div class="col-md-8 col-md-offset-1">

                                      <div class="row">
                                  <div class="col-lg-4">
                                  <label>Nama kualitas <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text"  class="form-control"  name="idcard_quality_name" placeholder="Nama kualitas"style="width:200px;height:30px" value="{{$quality->idcard_quality_name}}" required /></input>
                                  </div>
                                  </div>
                                  <br>
                                  <div class="row">
                                  <div class="col-lg-4">
                                  <label>Harga <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text"  class="form-control"  name="idcard_quality_price" placeholder="Harga"style="width:200px;height:30px" value="{{$quality->idcard_quality_price}}" required /></input>
                                  </div>
                                  </div>
                                  <br>
                                    <div class="row">
                                    <div class="col-lg-4">
                                      <label>Qty </label>
                                    </div>
                                    <div class="col-lg-3">
                                     <input type="text"  class="form-control"  name="idcard_quality_qty" placeholder="1" style="width:90px;height:30px" value="{{$quality->idcard_quality_qty}}" /></input>
                                    </div>
                                    <div class="col-lg-1">
                                     /
                                    </div>
                                    <div class="col-lg-3">
                                      <select  class="form-control"  name="idcard_quality_unit" style="width:90px;height:30px">
                                      <?php
                                      $units = array('Pcs','Card','Box');
                                      $qualityunit = $quality->idcard_quality_unit;
                                      foreach($units as $key => $unit){
                                      if($unit == $qualityunit){
                                          echo '<option value="'.$unit.'" selected >'.$unit.'</option>';
                                        }else{
                                          echo '<option value="'.$unit.'">'.$unit.'</option>';
                                        }
                                      }
                                      ?>
                                      </select>
                                    </div>
                                    </div>

                              </div>
                              </div>   
                    
                    </div>
                    <div class="modal-footer">

                    <button type="submit" class="btn btn-sm btn-dark"><span class="fa fa-floppy-o"></span> Simpan</button>{{Form::close()}} <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Batal</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>
              @endforeach


</div>
@stop
@stop